package org.hhchat.leetcode.dp;

/**
 * Created this one by HMH on 2017/6/11.
 */
public class code392 {
    public static class Solution {
        public boolean isSubsequence(String s, String t) {
            int last=0;
            for(char c:s.toCharArray()){
                int cur = t.indexOf(c, last);
                if(cur>=0){
                    last=cur+1;
                }
                else{
                    return false;
                }
            }
            return true;
        }

        public static void main(String[] args){
            String s = "axc";
            String t = "ahbgdc";
            Solution solution = new Solution();
            System.out.println(solution.isSubsequence(s, t));

        }

    }
}
